/**
 * ____________________ *
 *  ____ ____ ____ _  _ *
 *  |___ [__] |--< |\/| *
 * ____________________ *
 *
 * THE CORM PROJECT
 *
 * This file may only be used in accordance with the
 * terms of the Academic Free License ("AFL") v. 3.0,
 * as published by the Open Software Initiative.  A
 * copy of this license is provided in this source
 * release, and may be viewed online at:
 *
 * (http://www.opensource.org/licenses/afl-3.0.php)
 */
package org.eremite.corm.party;

import org.eremite.corm.BaseArchetype;

import javax.persistence.*;

@Entity
public class Binding extends BaseArchetype {

    private int salience = 0;

    @ManyToOne(cascade = {
            CascadeType.PERSIST,
            CascadeType.MERGE})
    private BindingValue value = new BindingValue();

    @ManyToOne(cascade = {
            CascadeType.PERSIST,
            CascadeType.MERGE})
    private BindingType type = new BindingType();

    public Binding() {}

    public Binding(String name) {
        setName(name);
    }

    public Binding(String name, BindingType type, BindingValue value) {
        setName(name);
        setType(type);
        setValue(value);
    }

    public int getSalience() {
        return salience;
    }

    public void setSalience(int salience) {
        this.salience = salience;
    }

    public BindingValue getValue() {
        return value;
    }

    public void setValue(BindingValue value) {
        this.value = value;
    }

    public BindingType getType() {
        return type;
    }

    public void setType(BindingType type) {
        this.type = type;
    }
}